// import { instance } from '@/util/request'
import instance from '../util/request'
export const userRegisterService = async ({ username, password, repassword }) => {
  return await instance.post('/api/reg', {
    username,
    password,
    repassword
  })
}

export const userLoginService = async ({ username, password }) =>
  await instance.post('/api/login', {
    username,
    password
  })

export const userGetInfoService = async () => instance.get('/my/userinfo')

// 更新用户资料
export const userUpdateInfoService = async (data) => instance.put('/my/userinfo', data)
// 更新用户头像
export const userUpdateAvatarService = async ({ avatar }) =>
  instance.PATCH('/my/update/avatar', { avatar })
